home *** CD-ROM | disk | FTP | other *** search
/ BCI NET / BCI NET Dec 94.iso / archives / programming / source / gblanker3.5.src.lha / GSource / libraries.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-19  |  1.2 KB  |  56 lines

  1. /*
  2.  *  Copyright (c) 1994 Michael D. Bayne.
  3.  *  All rights reserved.
  4.  *
  5.  *  Please see the documentation accompanying the distribution for distribution
  6.  *  and disclaimer information.
  7.  */
  8.  
  9. #include <string.h>
  10.  
  11. #include "includes.h"
  12.  
  13. #define NUM_LIBS ( sizeof( LibNames ) / sizeof( STRPTR ))
  14.  
  15. STRPTR LibNames[] = {
  16.     "dos.library", "intuition.library", "graphics.library",
  17.     "commodities.library", "Garshnelib.library", "gadtools.library",
  18.     "utility.library", "icon.library"
  19.     };
  20. LONG LibVersions[] = { 37, 37, 37, 37, 37, 37, 37, 37 };
  21. struct Library *Libraries[NUM_LIBS];
  22.  
  23. LONG OpenLibraries( VOID )
  24. {
  25.     LONG i;
  26.  
  27.     for( i = 0; i < NUM_LIBS; i++ )
  28.     {
  29.         Libraries[i] = OpenLibrary( LibNames[i], LibVersions[i] );
  30.         if( !Libraries[i] )
  31.         {
  32.             if( IntuitionBase )
  33.             {
  34.                 struct EasyStruct ErrorReq = {
  35.                     sizeof( struct EasyStruct ), 0, "Information", 0L, "Ok" };
  36.                 BYTE ErrorStr[64];
  37.  
  38.                 strcpy( ErrorStr, LibNames[i] );
  39.                 strcat( ErrorStr, " failed to open." );
  40.                 ErrorReq.es_TextFormat = ErrorStr;
  41.                 EasyRequestArgs( 0L, &ErrorReq, 0L, 0L );
  42.             }
  43.             return 1L;
  44.         }
  45.     }
  46. }
  47.  
  48. VOID CloseLibraries( VOID )
  49. {
  50.     LONG i;
  51.  
  52.     for( i = 0; i < NUM_LIBS; i++ )
  53.         if( Libraries[i] )
  54.             CloseLibrary( Libraries[i] );
  55. }
  56.